<?php
namespace Home\Controller;
use Think\Controller;
class IndexController extends Controller {   
    public function index(){
        
     $category=M('category');
     $catelist=$category->where('pid=0')->select();
    
     foreach ($catelist as $v)//对一级分类循环
     {
         $v['child']=fenlei($v['cid']);
     }
     $this->assign("catelist",$catelist);
     
     $best=M('goods');
     $bestlist=$best->where("is_best='yes' and recycle='no'")->select();
      $this->assign("bestlist",$bestlist);
      
      $this->display();
  }
 
    
   }
